#include "head_s.h"


// 和客户端进行通信的函数
int do_worker(int net_fd, MYSQL* mysql){
    portocol_t portocol;
    user_t status;
    char base_path[100] = {0};
    getparameter("base_path", base_path);
    sprintf(status.base_path, "%s", base_path);
    //recv(net_fd, &portocol, sizeof(portocol_t), MSG_WAITALL);
    read_stdin(&status, &portocol, net_fd);
    LOG_WRITE(LOG_ERROR, "%d\n", portocol.cmd);
    LOG_WRITE(LOG_ERROR, "%s\n", portocol.arg);
    if (portocol.cmd == PUTS)
    {
        upload(&status, &portocol, net_fd, mysql);
    }
    else
    {
        download(&status, net_fd, mysql);
    }

    return  0;
}


